<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTrainingScenariosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('training_scenarios', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name', 100);
            $table->text('description')->nullable();
            $table->text('objective')->comment('训练目标');
            $table->text('success_criteria')->nullable()->comment('成功标准 JSON字符串格式');
            $table->text('scenario_prompt')->nullable()->comment('场景设定提示词');
            $table->text('tags')->nullable()->comment('标签，逗号分隔');
            $table->unsignedTinyInteger('difficulty_level')->default(1)->comment('难度等级 1-5');
            $table->boolean('is_active')->default(true);
            $table->timestamp('created_at')->useCurrent();
            
            // 索引
            $table->index(['is_active']);
            $table->index(['difficulty_level']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('training_scenarios');
    }
}